import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  // {
  //   title: '创建日期',
  //   align: "center",
  //   dataIndex: 'createTime'
  // },
  {
    title: '标题',
    align: 'center',
    dataIndex: 'title',
  },
  {
    title: '投诉反馈内容',
    align: 'center',
    dataIndex: 'content',
  },
  {
    title: '联系方式',
    align: 'center',
    dataIndex: 'phone',
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '创建日期',
    field: 'createTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
    },
    //colProps: {span: 6},
  },
  {
    label: '标题',
    field: 'title',
    component: 'Input',
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  // {
  //   label: '创建日期',
  //   field: 'createTime',
  //   component: 'DatePicker',
  //   componentProps: {
  //     showTime: true,
  //     valueFormat: 'YYYY-MM-DD HH:mm:ss'
  //   },
  // },
  {
    label: '标题',
    field: 'title',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入标题!' }];
    },
  },
  {
    label: '投诉反馈内容',
    field: 'content',
    component: 'InputTextArea',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入投诉反馈内容!' }];
    },
  },
  {
    label: '联系方式',
    field: 'phone',
    component: 'Input',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
